layui.use(['form'], function () {
    var form = layui.form;
    form.on('submit(btn_add)', function (data) {
        ajaxAdd(data.field);
        return false;
    });
});
function ajaxAdd(data) {
    var url = "/crud/handler";
    var subIndex=showLoading('数据提交中...');
    postAjax(url, data, function (res) {
        if (res["code"] == 0) {
            layer.close(subIndex);
            dialogGoon(res["msg"], function () {
                $("#rest-btn").click();
            }, function () {
            });
        } else {
            layer.alert(res["msg"]);
        }
    }, function () {
        layer.close(subIndex);
        layer.msg("提交发生异常");
    });
}
